package com.wx.router.interceptor;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.wx.service.WxUserLogService;
import com.wx.service.impl.WxUserLogServiceImpl;

import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageInterceptor;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;

public class WxLogInterceptor implements WxMpMessageInterceptor {
	static Logger logger = LoggerFactory.getLogger(WxLogInterceptor.class);

	@Override
	public boolean intercept(WxMpXmlMessage wxMessage, Map<String, Object> context, WxMpService wxMpService,
			WxSessionManager sessionManager) throws WxErrorException {
		logger.debug("WxLogInterceptor interceptor");
		WxUserLogService service = new WxUserLogServiceImpl();
		service.saveWxUserLog(wxMessage);
		return true;
	}

}
